<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

$max = 51;
$id = $db->getColumn("select `sm_id` from `short_messages` order by `sm_id` desc limit $max");
$id = (count($id) != $max) ? 0 : $id[count($id)-1];
echo $id;

?>